package com.example.demo.common;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/*
* 文件的配置类扫描到本地的d盘D:/restaurantRes/
* */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
        //windows本地文件目录1
     //   registry.addResourceHandler("/restaurantRes/**").addResourceLocations("file:D:/restaurantRes/");

        //linux
        registry.addResourceHandler("/static/restaurantRes/**").addResourceLocations("file:/root/restaurantRes/");
        ///root/scimages

        super.addResourceHandlers(registry);
    }
}